﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using PBOffice.Models;
using PBOffice.BLL;

public partial class FileManager_AddFolder : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //int nodeId = Convert.ToInt32(Request.QueryString["nodeid"]);
        string path = Request.QueryString["pos"];
        //this.lbOwner.Text = Session["username"].ToString();
        this.lbPosition.Text = path;
        this.lbCreateDate.Text = DateTime.Now.ToShortDateString();
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        FileInfo file = new FileInfo();
        file.FileName = this.txtName.Text.Trim();
        file.FileOwner = "admin";
        file.CreateDate =DateTime.Now;
        file.FilePath = lbPosition.Text + "\\" + this.txtName.Text.Trim();
        FileTypeInfo type = new FileTypeInfo();
        type.FileTypeId = 1;
        type.FileTypeName = "文件夹";
        file.FileType =type;
        file.IfDelete = 0;
        file.ParentId = Convert.ToInt32(Request.QueryString["nodeid"]);
        file.Remark = this.txtRemark.Text.Trim();
        new FileInfoManager().AddFileInfo(file);
        System.IO.Directory.CreateDirectory(Server.MapPath(file.FilePath));
    }
    protected void btnCancle_Click(object sender, EventArgs e)
    {
        Response.Redirect("FileManager.aspx");
    }
}